<template>
  <div id="wrap">
    <button @click="isShow = !isShow">按钮</button>
    <transition name="anime">
      <div v-show="isShow"></div>
    </transition>
  </div>
</template>

<script>
export default {
  name: "Anime2",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>

<style scoped>
#wrap div {
  width: 150px;
  height: 50px;
  background-color: rgb(163, 255, 224);
}
@keyframes boxRotate {
  0% {
    transform: translateX(100px);
    opacity: 0;
  }
  100% {
    transform: translateX(0px);
  }
}
.anime-enter-active {
  animation: boxRotate 0.5s linear;
}
.anime-leave-active {
  animation: boxRotate 0.5s linear reverse;
}
</style>
